SSL and regular VHost on the same server [duplicate]
Posted
by
Pascal Boutin
on Server Fault
See other posts from Server Fault
or by Pascal Boutin
Published on 2014-06-05T03:16:04Z
Indexed on
2014/06/05
3:27 UTC
Read the original article
Hit count: 156
This question already has an answer here:
I have a server running Apache 2.4 on which run several virtual hosts. The problem I noticed is that if I try to access let's say https://example.com
that have no SSL setuped, apache will automatically try to access the first VHost that has SSL activated (which is litteraly not the same site). How can we prevent this strange behaviour, or in other words, how to say to Apache to ignore SSL for a given site.
Here's sample of what my .conf files look like :
<VirtualHost foobar.com:80>
DocumentRoot /somepath/foobar.com
<Directory /somepath/foobar.com>
Options -Indexes
Require all granted
DirectoryIndex index.php
AllowOverride All
</Directory>
ServerName foobar.com
ServerAlias www.foobar.com
</VirtualHost>
<VirtualHost test.example.com:443>
DocumentRoot /somepath/
<Directory /somepath/>
Options -Indexes
Require all granted
AllowOverride All
</Directory>
ServerName test.example.com
SSLEngine on
SSLCertificateFile [...]
SSLCertificateKeyFile [...]
SSLCertificateChainFile [...]
</VirtualHost>
With this, if I try to access https://foobar.com
chrome will show me a SSL error that mention that the server was identifying itself as test.example.org
Thanks in advance !
© Server Fault or respective owner